package com.qf.api.order.fallback;

import com.qf.api.order.feign.OrderFeignService;
import com.qf.common.core.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author GaoQiangLiang
 * @date 2025-06-13 21:50
 */

@Slf4j
@Component
public class OrderFallbackFactory implements FallbackFactory<OrderFeignService> {
    @Override
    public OrderFeignService create(Throwable cause) {
        return new OrderFeignService() {
            @Override
            public R getOrderInfo(Integer goodsid) {
                log.error("订单服务远程调用失败：{}", cause.getMessage());
                return R.fail("用户订单信息获取失败!");
            }
        };
    }
}
